
	** Uganda
	** Clean wave 5
		
	** Urban status
	
		use "$dir/rawdata/LSMS Uganda/2015/gsec1.dta", clear
		gen w5_urban=urban==1
		
		keep HHID w5_*
		ren HHID hhid
		
		tempfile urban
		save `urban', replace
		
	** Roster
		use "$dir/rawdata/LSMS Uganda/2015/gsec2.dta", clear
		
		gen w5_female=h2q3==2 if !missing(h2q3)
		gen w5_age=h2q8
		gen w5_married=(h2q10==1 | h2q10==2) if !missing(h2q10)
		
		gen w5_inhh=h2q7<=4
		
		bys hhid: egen w5_hh_size=total(w5_inhh)
		ren pid indiv
		
		keep hhid indiv w5_*
		tempfile roster
		save `roster', replace
		
	** Illness or injury
	
		use "$dir/rawdata/LSMS Uganda/2015/gsec5.dta", clear
	
		gen w5_illinj=h5q4==1 if !missing(h5q4)
		gen w5_illinjstopactivities=h5q6>0 if !missing(h5q6)
		replace w5_illinjstopactivities=0 if w5_illinj==0
		
		ren pid indiv 
		
		keep hhid indiv w5_*		
		tempfile illinj
		save `illinj', replace
		
	** Employment 
		
		use "$dir/rawdata/LSMS Uganda/2015/gsec8.dta", clear
		
		gen w5_work_outsideHH=h8q4==1 if !missing(h8q4)
		
		gen w5_work_bizHH=(h8q6==1 | h8q8==1) if (!missing(h8q6) | !missing(h8q8))
		
		gen w5_work_agHH=(h8q12==1) if !missing(h8q12)
		
		egen w5_worked_last7days=rowmax(w5_work_outsideHH w5_work_agHH w5_work_bizHH)
		
		egen w5_work_hrs=rowtotal(h8q36a h8q36b h8q36c h8q36d h8q36e h8q36f h8q36g h8q43), mi // inludes working on a household business, agriculture, etc.
		
		ren pid indiv
		keep hhid indiv w5_*
		
		tempfile employment
		save `employment', replace

	** Disabilities
	
		*n/a
		
	** Merge and save
	
		use `roster', clear
		merge 1:1 hhid indiv using `illinj', gen(merge_illinj)
		merge 1:1 hhid indiv using `employment', gen(merge_employment)
		merge m:1 hhid using `urban', gen(merge_urban)
		
		save "$dir/data/uga_w5_individual.dta", replace
